package com.sl.au.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.Role;

public interface RoleRepository extends JpaRepository<Role, String> {
	@Query(" select m from Role m where m.description like %?1% or m.name like %?1% ")
	Page<Role> getRoleName(String key, Pageable pageable);

	/// 有没有重复角色
	@Query("select count(r) from Role r where r.name=?1")
	long getRoleCount(String name);

	Role findByName(String name);
}
